﻿@using Microsoft.Extensions.Options
@inject IOptions<AppSettings> AppSettings
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <meta name="format-detection" content="telephone=no">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <title>@ViewData["Title"] - @AppSettings.Value.SiteTitle</title>

    <environment names="Development">
        <link rel="stylesheet" href="~/lib/amazeui/css/amazeui.css"/>
        <link rel="stylesheet" href="~/css/site.css"/>
    </environment>
    <environment names="Staging,Production">
        <link rel="stylesheet" href="http://cdn.amazeui.org/amazeui/2.5.0/css/amazeui.min.css"
              asp-fallback-href="~/lib/amazeui/css/amazeui.min.css"
              asp-fallback-test-class="sr-only" asp-fallback-test-property="position" asp-fallback-test-value="absolute"/>
        <link rel="stylesheet" href="~/css/site.min.css" asp-append-version="true"/>
    </environment>
    <link href="~/css/simplemde.min.css" type="text/css" rel="stylesheet" />
</head>
<body>
    <header class="am-topbar">
        <h1 class="am-topbar-brand">
            <a asp-controller="Home" asp-action="Index">ZBlog</a>
        </h1>

        <button class="am-topbar-btn am-topbar-toggle am-btn am-btn-sm am-btn-success am-show-sm-only"
                data-am-collapse="{target: '#doc-topbar-collapse'}">
            <span class="am-sr-only">导航切换</span> <span class="am-icon-bars"></span>
        </button>

        <div class="am-collapse am-topbar-collapse" id="doc-topbar-collapse">
            <ul class="am-nav am-nav-pills am-topbar-nav">
                <li><a asp-controller="Home" asp-action="Index">Home</a></li>
                <li><a asp-controller="Home" asp-action="About">About</a></li>
                @await Html.PartialAsync("_LoginPartial")
            </ul>

            <form class="am-topbar-form am-topbar-left am-form-inline am-topbar-right" role="search">
                <div class="am-form-group">
                    <input type="text" class="am-form-field am-input-sm" placeholder="search here.">
                </div>
                <button type="submit" class="am-btn am-btn-default am-btn-sm">Search</button>
            </form>
        </div>
    </header>

    <div class="am-g am-g-fixed blog-g-fixed">
        <div class="am-u-md-8">
            @RenderBody()
        </div>

        <div class="am-u-md-4 blog-sidebar">
            <div class="am-panel-group">
                <section class="am-panel am-panel-default">
                    <div class="am-panel-hd">About Me</div>
                    <div class="am-panel-bd">
                        <p>
                            @AppSettings.Value.AboutMeInShort
                            <hr/>
                            <a href="http://github.com/Jeffiy" title="github" class="am-icon-btn am-icon-github" target="_blank"></a>
                            <a href="http://weibo.com/zmm610" title="weibo" class="am-icon-btn am-icon-weibo" target="_blank"></a>
                            <a href="http://t.qq.com/as1542963" title="tencent-weibo" class="am-icon-btn am-icon-tencent-weibo" target="_blank"></a>
                        </p>
                        <a class="am-btn am-btn-success am-btn-sm" asp-controller="Home" asp-action="About">More →</a>
                    </div>
                </section>
                <section class="am-panel am-panel-default">
                    @await Component.InvokeAsync("Tag")
                </section>
                <section class="am-panel am-panel-default">
                    @await Component.InvokeAsync("Catalog")
                </section>
                <section class="am-panel am-panel-default">
                    @await Component.InvokeAsync("TopPosts")
                </section>
            </div>
        </div>
    </div>

    <form id="form-logout" asp-controller="Admin" asp-action="Logout" method="POST" class="am-hide"></form>

    <footer class="blog-footer">
        <p>
            <a href="https:\\github.com\Jeffiy\ZBlog-Net" target="_blank">ZBlog</a> powered by ASP.NET Core 2.0<br />
            <small>&copy; @DateTime.Now.Year - @AppSettings.Value.SiteTitle.</small>
        </p>
    </footer>

    <environment names="Development">
        <script src="~/lib/jquery/dist/jquery.js"></script>
        <script src="~/lib/amazeui/js/amazeui.js"></script>
        <script src="~/js/site.js" asp-append-version="true"></script>
    </environment>
    <environment names="Staging,Production">
        <script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-2.1.4.min.js"
                asp-fallback-src="~/lib/jquery/dist/jquery.min.js"
                asp-fallback-test="window.jQuery">
        </script>
        <script src="http://cdn.amazeui.org/amazeui/2.5.0/js/amazeui.min.js"
                asp-fallback-src="~/lib/amazeui/js/amazeui.min.js"
                asp-fallback-test="window.jQuery && window.jQuery.AMUI">
        </script>
        <script src="~/js/site.min.js" asp-append-version="true"></script>
    </environment>
    <script type="text/javascript" src="~/js/simplemde.min.js"></script>
    <script type="text/javascript">
        jQuery(function ($) {
            //设置活动菜单项
            var url = "@Context.Request.Path";
//            console.debug(url);
            var href = "";
            $("ul.am-topbar-nav a[href]").each(function () {
                href = $(this).attr("href");
//                console.debug(href);
                if (url.indexOf(href) >= 0) {
                    $("ul.am-topbar-nav li").removeClass("am-active");
                    var p1 = $(this).parent("li");
                    p1.addClass("am-active");

                    //循环设置父级菜单样式
                    for (var i = 0; i < 3; i++) {
                        p1 = p1.parent();
                        if (p1 != undefined) {
                            if (p1.hasClass("am-topbar-nav")) {
                                break;
                            } else {
                                if (p1.hasClass("am-dropdown")) {
                                    p1.addClass("am-dropdown-toggle-hover");
                                    break;
                                }
                            }
                        } else {
                            break;
                        }
                    }
                }
            });

            //默认选择第一个菜单项
            if ($("ul.am-topbar-nav li.am-active").length <= 0) {
                $("ul.am-topbar-nav li:eq(0)").addClass("am-active");
            }
        });
    </script>
    <script id="dsq-count-scr" src="//zhangmm.disqus.com/count.js" async></script>
    @RenderSection("scripts", required: false)
</body>
</html>
